<?
include("../../MerchandiseBay/conn.php");

//ambil data dari kindForm.php
$category=$_REQUEST['category'];
$kind=$_REQUEST['kind'];
$model=$_REQUEST['model'];


$modelSQL="select * from model where model='$model'and kind='$kind' and category='$category'";
$modelQuery=mysql_query($modelSQL,$conn);


?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>New Page 1</title>
<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
body {
	background-color: #330000;
}
.style3 {color: #000000}
.style4 {color: #000066}
-->
</style>
</head>
<body>
<?
if(mysql_num_rows($modelQuery)>0) //check data sama ada nilai tersebut ada dalam database atau tidak
{ 
$row=mysql_fetch_assoc($modelQuery);//ambil data pada baris tersebut
?>

<div align="left">
  <table border="1" width="462" style="border-collapse: collapse" bordercolor="#333333">
    <tr><td>
      <table width="102%" border="0" bordercolor="#333333" bgcolor="#CCCCCC" id="table1">
        <tr>
          <td background="../mc/images/background/m3.jpg"><font color="#FF0000" size="4" face="Verdana">ERROR</font><span class="style1"><font size="4" face="Verdana">!</font></span></td>
	      </tr>
        <tr>
          <td><span class="style3"><font size="2" face="Verdana">&nbsp;Your choice already in the system record</font></span></td>
	      </tr>
        <tr>
          <td><span class="style3"><font face="Verdana" size="2">&nbsp;<strong>Model :</strong> <? echo $row['model']?></font></span></td>
	      </tr>
        <tr>
          <td align="center">
            <input type="button" value="&lt;&lt; Back" name="B4" onClick="history.back();"></td>
	      </tr>
    </table></td></tr>
  </table>
</div>
<? }
else {
//data tiada dalam database.proses untuk masukkan data akan dibuat
$modelInsertSQL="insert into model(category,kind,model)values('$category','$kind','$model')";
$modelInsertQuery=mysql_query($modelInsertSQL,$conn);
?>

<div align="left">
  <table border="1" width="462" style="border-collapse: collapse" bordercolor="#333333">
    <tr bgcolor="#CCCCCC"><td>
      <table width="100%" border="0" bordercolor="#333333" id="table1">
        <tr>
          <td background="../mc/images/background/blueBG.gif"> <span class="style4"><font face="Verdana" size="4">Add Model Successfull Recorded</font></span></td>
	      </tr>
        <tr>
          <td height="20"><font size="2" face="Verdana"><span class="style3">&nbsp;<strong>Model:</strong></span> 
            <?=$model?></font></td>
	      </tr>
        <tr>
          <td><font size="2" face="Verdana">&nbsp;</font></td>
	      </tr>
        <tr>
          <td>&nbsp;</td>
	      </tr>
        <tr>
          <td>&nbsp;</td>
	      </tr>
        <tr>
          <td>
            <p align="center"><font size="2" face="Verdana"> <a href="kindModel.php">Add Model </a>| <a href="registerProduct.php" target="_parent">Register Product</a> |  <a href="listModel.php"> List Model</a></font></td>
	      </tr>
    </table></td></tr>
  </table>
</div>
<? }?>
</body>

</html>